<template>
  <div class="course-detail">
    <!-- 头部 -->
    <course-header  :base="courseDetail" />

    <!-- 内容部分 -->
    <course-content  :data="courseDetail" />
  </div>
</template>
<script>
import CourseHeader from './course-detail-header.vue'
import CourseContent from './course-detail-content.vue'
import { getCourseDetail } from 'api/course.js'
import { ERR_OK } from 'api/config.js'
import {dealHistory} from "../../api/course";
export default {
  name: 'CourseDetail',
  data () {
    return {
      courseDetail: {
      }
    }
  },
  created () {
    this.$nextTick(() => {
      this.getCourseDetailData()
    })
  },
  methods: {
    // 获取课程详情
    getCourseDetailData () {
      const id = this.$route.params.id
      getCourseDetail(id).then(res => {
        let { code, data } = res
        if (code === ERR_OK) {
          this.courseDetail = data
        }
      })
    }
  },
  components: {
    CourseHeader,
    CourseContent
  }
}
</script>
